//
//  ZHHomeTableViewController.m
//  Doctor
//
//  Created by liuzhishan on 15/12/14.
//  Copyright © 2015年 shanshan. All rights reserved.
//

#import "ZHHomeTableViewController.h"
#import "ZHHomeTableViewCell.h"
#import "ZHHospitalModel.h"


@interface ZHHomeTableViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,retain) UIImageView *imageBg;
@property (nonatomic,retain) UIImageView *imageTitleBg;
@property (nonatomic,retain) UIImageView *imageDownBg;
@property (nonatomic,retain) UIImageView *imageLogo;

@property (nonatomic,retain) UIButton *btnChange;

@property (nonatomic,retain) UIButton *btnChooseAll;


@property (nonatomic,retain) UITableView *myTableView;

@end

@implementation ZHHomeTableViewController
-(void)addMyBgViews

{
    
    self.imageTitleBg = [[UIImageView alloc]init];
    self.imageTitleBg.image = [UIImage imageNamed:@"Login-up"];
    [self.imageTitleBg setMyFramewithX:0 andY:0 andWidth:1024 andHeight:68];
    [self.view addSubview:self.imageTitleBg];
    
    self.imageDownBg = [[UIImageView alloc]init];
    
    self.imageDownBg.image = [UIImage imageNamed:@"Login-under"];
    
    [self.imageDownBg setMyFramewithX:0 andY:719 andWidth:1024 andHeight:49];
    [self.view addSubview:self.imageDownBg];
    
    
    self.imageBg = [[UIImageView alloc]init];
    self.imageBg.image = [UIImage imageNamed:@"login-background"];
    [self.imageBg setMyFramewithX:0 andY:68 andWidth:1027 andHeight:651];
    //self.imageBg.backgroundColor = [UIColor redColor];
    [self.view addSubview:self.imageBg];
    
    
    self.imageLogo = [[UIImageView alloc]init];
    self.imageLogo.image = [UIImage imageNamed:@"home-4"];
    [self.imageLogo setMyFramewithX:35 andY:630 andWidth:241 andHeight:67];
    //self.imageBg.backgroundColor = [UIColor redColor];
    [self.view addSubview:self.imageLogo];
    
    
    self.btnChange = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.btnChange setMyFramewithX:829 andY:123 andWidth:74 andHeight:48];
    [self.btnChange setBackgroundImage:[UIImage imageNamed:@"table-1"] forState:UIControlStateNormal];
    [self.view addSubview:self.btnChange];
    
    [self.btnChange addTarget:self action:@selector(changeViewController) forControlEvents:(UIControlEventTouchUpInside)];
    
    
    
    self.btnChooseAll = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.btnChooseAll setMyFramewithX:798 andY:608 andWidth:173 andHeight:35];
    [self.btnChooseAll setBackgroundImage:[UIImage imageNamed:@"home-3"] forState:UIControlStateNormal];
    [self.view addSubview:self.btnChooseAll];
    
    [self.btnChooseAll addTarget:self action:@selector(selectAllMyChoose) forControlEvents:(UIControlEventTouchUpInside)];
    
    
}






-(void)selectAllMyChoose
{
    
}

-(void)changeViewController
{
  [self dismissViewControllerAnimated:YES completion:^{
      
      
  }];
    
    
}


- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    
    [self addMyBgViews];
    
    self.myTableView = [[UITableView alloc]init];
    [self.myTableView setMyFramewithX:28 andY:106 andWidth:667 andHeight:514];
    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
    self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    
      self.myTableView.backgroundColor = BGCOLOR;
    
    [self.view addSubview:self.myTableView];
  
    
    
  
    
    
   }

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    return  self.dataArray.count;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"hospitalTableCell";
    
    ZHHomeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    
    if (!cell) {
        
        cell = [[ZHHomeTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    
    ZHHospitalModel *model = [self.dataArray objectAtIndex:indexPath.row];
    
    
    cell.model = model;
    
    return cell;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return  120*HEIPro;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
